//
//  MYFactoryManager.h
//  GoHiking_app
//
//  Created by qf on 15/10/13.
//  Copyright (c) 2015年 qf. All rights reserved.
//

#import <Foundation/Foundation.h>
//懒加载专用
@interface MYFactoryManager : NSObject

#pragma 高宽度的适应计算
/**高度自适应*/
+ (CGFloat)heightForString:(NSString *)string fontSize:(CGFloat)fontSize andWidth:(CGFloat)width;
/**宽度自适应*/
+ (CGFloat)widthForString:(NSString *)string fontSize:(CGFloat)fontSize andHeight:(CGFloat)height;

#pragma 时间计算
//时间计算
+ (NSString *)getStartTimeDate:(double)dateTime format:(NSString *)format;
+ (NSString *) returnUploadTime:(NSString *)timeStr;
//返回时间戳
+ (NSString *)returnTimestamp:(NSString *)timeStr;

#pragma mark 字符与字典的转换
//字符串转字典与字典转字符串
+ (NSDictionary *)parseJSONStringToNSDictionary:(NSString *)JSONString;
+ (NSString*)dictionaryToJson:(NSDictionary *)dic;
+ (NSString*)arrayToJson:(NSArray *)arr;
+ (NSArray *)parseJSONStringToNSArray:(NSString *)JSONString;

//判断对象是否为空
+ (NSString *)returnRealValue:(id)sendValue;

#pragma 各种格式检验
//获取部分显示手机格式
+ (NSString *)getPhoneText:(NSString *)phoneNum;
//手机格式
+ (BOOL)phoneNum:(NSString *)textString;
//大陆手机格式+86
+ (BOOL)CHPhoneNum:(NSString *)textString;
//香港手机格式+852
+ (BOOL)HKPhoneNum:(NSString *)textString;
//数字检验
+ (BOOL)validateNumber:(NSString*)number;
//判断输入的是否是表情
+(BOOL)isContainsEmoji:(NSString *)string;
//判断身份证号
+ (BOOL) validateIdentityCard: (NSString *)identityCard;
//判断金钱输入
+ (BOOL)ConformToTheMoneyInputString:(NSString *)string shouldChangeCharactersInRange:(NSRange)range currtentTextField:(UITextField *)textField;

#pragma 缓存文件处理
//计算缓存文件的大小
+(float)getCacheSize;
//清楚缓存文件
+(void)clearCache;

#pragma 登录页的快速跳转
//调到登录页
//+ (BOOL)pushVCToLoginController:(UIViewController *)selfVC  withTableView:(BaseTableView *)tableView;
+ (BOOL)quickPushVCToLoginController:(UIViewController *)selfVC;

//判断系统版本
+(int)osVersion;

// 设置本地通知
+ (void)registerLocalNotification:(NSDate*)alertDate alertBody:(NSString *)alertBody userDict:(NSDictionary *)userDict;
// 取消某个本地推送通知
+ (void)cancelLocalNotificationWithKey:(NSString *)key;

//数字返回 大于万时返回xxxx万
+ (NSString *)returnTenThousand:(NSInteger)num;
//数字返回 大于100时返回99+
+ (NSString *)returnHundred:(NSInteger)num;

+ (int)convertToInt:(NSString *)strtemp maxLength:(int)maxLen;

//添加文字阴影
+ (NSMutableAttributedString *)shadowString:(NSString *)str;
//加文字阴影自定义
+ (NSMutableAttributedString *)shadowString:(NSString *)str shadowOffset:(CGSize)offset shadowColor:(UIColor *)color;
//添加渐隐效果
+ (CAGradientLayer *)setGradualChangingColor:(UIView *)view fromColor:(UIColor *)fromColor toColor:(UIColor *)toColor;
// 自适应尺寸大小
+ (NSString *)webImageFitToDeviceSize:(NSString *)str;
+(NSMutableAttributedString*)subStr:(NSString *)string;
//获取查找字符串在母串中的NSRange
+ (NSArray *)rangesOfString:(NSString *)searchString inString:(NSString *)str;
//价格显示--为整则去除小数点
+ (NSString *)formatFloat:(float)f;
@end
